package com.wangzh.service.impl;

import com.wangzh.service.IMessageServcie;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class MessageServiceImpl implements IMessageServcie {

    private List<String> list = new ArrayList<>();
    @Override
    public void sendMessage(String id) {

        log.info("待发送短信的订单已纳入队列，id：{}",id);
        list.add(id);
    }

    @Override
    public String doMessage() {

        String remove = list.remove(0);
        log.info("已完成发送短信任务，id：{}",remove);
        return remove;
    }
}
